package com.vic.test.designpattern._1factorypattern.easyfactorypattern;

public class PizzaStore {
    //通过组合的使用，加上一个简单工厂SimplePizzaFactory的引用，用于创建pizza
    SimplePizzaFactory factory;

    public PizzaStore(SimplePizzaFactory factory) {
        this.factory = factory;
    }

    public Pizza orderPizza(String type) {
        Pizza pizza;
        //调用简单工厂SimplePizzaFactory的createPizza(type)方法创建pizza
        pizza = factory.createPizza(type);

        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();

        return pizza;
    }

}
